﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyDBconnection;

namespace CamposInventory
{
    public partial class frmChangepass : Form
    {
        DatabaseConnection dbconn = new DatabaseConnection();
        FrmMain parent;
        
        
        public frmChangepass(FrmMain p)
        {
            
            InitializeComponent();
            btnchange.Click += new EventHandler(btnchange_Click);
            parent = p;
            
        }

        void btnchange_Click(object sender, EventArgs e)
        {
            dbconn.dbconnection();
            dbconn.UpdatePassword("Update userdb.tbluser set  Password ='" + this.txtnewpass.Text + "' where Password='" + this.txtOldpass.Text +  "';");
            MessageBox.Show("Password Changed","Password changed",MessageBoxButtons.OK,MessageBoxIcon.Information);
            this.Close();
            dbconn.DBClose();
            clearing();
        }
        void clearing()
        {
            txtconfirm.Clear();
            txtnewpass.Clear();
            txtOldpass.Clear();
        
        
        }
    }
}
